package com.practise.rabbitmqdemo.listen;

import com.practise.rabbitmqdemo.config.TopicRabbitConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TopicReceiver {

    @RabbitListener(queues = {TopicRabbitConfig.TOPIC_QUEUE_1})
    public void processQ1(String msg) {
        log.info("监听:{} msg:{}" ,TopicRabbitConfig.TOPIC_QUEUE_1,msg);
        System.out.println("TOPIC_QUEUE_1 消费者收到消息  : " + msg);
    }


    @RabbitListener(queues = {TopicRabbitConfig.TOPIC_QUEUE_2})
    public void processQ2(String msg) {

        log.info("监听:{} msg:{}",TopicRabbitConfig.TOPIC_QUEUE_2,msg);
        System.out.println("TOPIC_QUEUE_1 消费者收到消息  : " + msg);
    }
}